/**
 * 登录注册找回密码API
 *
 * @版权所有 rem.studio
 */
import request from '@/utils/request';
import { getParamsSuffix } from '@/utils/paramsUtils';

/**
 * 测试用接口
 * @returns {Promise<any>}
 */
export async function sayHi(query) {
  const params = getParamsSuffix(query);
  return request(`/api/cdcerservice/v1/systeminit/sayHi?${params}`);
}

/**
 * 分页
 * @param query
 * @returns {Promise<any>}
 */
export async function listByPage(query) {
  const params = getParamsSuffix(query);
  return request(`/api/cdcerservice/v1/systeminit/listByPage?${params}`);
}

/**
 * 待同步cas用户数据分页
 * @param query
 * @returns {Promise<any>}
 */
export async function listByPageCasUserSync(query) {
  const params = getParamsSuffix(query);
  return request(`/api/cdcerservice/v1/casusersync/listByPage?${params}`);
}

/**
 * 查询未同步到系统用户的cas用户数量
 * @param query
 * @returns {Promise<any>}
 */
export async function queryAllUnInitSysuserCount(query) {
  const params = getParamsSuffix(query);
  return request(`/api/cdcerservice/v1/casusersync/queryAllUnInitSysuserCount?${params}`);
}

/**
 * 按照id,从临时表中,来查找对应的cas用户
 * @param query
 * @returns {Promise<any>}
 */
export async function findUserById(query) {
  const params = getParamsSuffix(query);
  return request(`/api/cdcerservice/v1/casusersync/findUserById?${params}`);
}

/**
 * 查询
 * @param query
 * @returns {Promise<any>}
 */
export async function execSelect(query) {
  const params = getParamsSuffix(query);
  return request(`/api/cdcerservice/v1/systeminit/execSelect?${params}`);
}

/**
 * 测试调用接口
 * @creater yang
 * @returns {Promise<any>}
 */
export async function testData(query) {
  const params = getParamsSuffix(query);
  return request(`/api/cdcerservice/v1/systeminit/testData?${params}`);
}

/**
 * 新增
 * @param params
 * @returns {Promise<any>}
 */
export async function execInsert(params) {
  return request('/api/cdcerservice/v1/casusersync/execInsert', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}

/**
 * 新增临时用户
 * @param params
 * @returns {Promise<any>}
 */
export async function addSysUser(params) {
  return request('/api/cdcerservice/v1/casusersync/addSysUser', {
    method: 'POST',
    data: { ...params },
  });
}

/**
 * 将临时库中的数据写入正式库当中
 * @param params
 * @returns {Promise<any>}
 */
export async function syncTmpUserToSysUser(params) {
  return request('/api/cdcerservice/v1/casusersync/syncTmpUserToSysUser', {
    method: 'POST',
    data: { ...params },
  });
}
